/**
 * 客户管理
 * @type {BaseCustomerApi}
 */
const baseCustomerApi = new class BaseCustomerApi extends BaseApi {
    constructor() {
        super({
            url: '/api/baseCustomer',
            exp: true,
            imp: true,
        })
    }

    async getForAllBaseHousesHoldInfo(id) {
        return (await rxajax.get(this.using(`/get-for-all-base-houses-hold-info/${id}`))).data.data
    }

    /**
     * 根据客户 id 添加服务信息
     * @param entity 实体类
     * @returns {Promise<Result>} 添加服务信息结果
     */
    async addBaseHousesHoldInfoByCustomerId(entity) {
        return (await rxajax.post(this.using('/add-base-houses-hold-info-by-customer-id'), entity, {type: 'json'})).data
    }

    async getByHoldId(customerId, holdId) {
        return (await rxajax.get(this.using(`/get-by-hold-id/${customerId}/${holdId}`))).data.data
    }

    async getByServiceId(customerId, serviceId) {
        return (await rxajax.get(this.using(`/get-by-service-id/${customerId}/${serviceId}`))).data.data
    }

    async insertReport(id) {
        return (await rxajax.post(this.using(`/insert-report/${id}`))).data
    }

    async updateReport(id) {
        return (await rxajax.post(this.using(`/update-report/${id}`))).data
    }
}()